package TransactionImplementation

import (
	"PaySalary/AbstractTransactions"
	"PaySalary/DataBase"
	"PaySalary/Model"
	"PaySalary/ModelImplementation"
)

type ChangeMemberTransaction struct {
	AbstractTransactions.ChangeAffiliationTransaction
	itsDues float64
	itsMemberId int
}

func (mt *ChangeMemberTransaction) newChangeMemberTransaction(empid int, memberId int, dues float64) {
	mt.ChangeAffiliationTransaction.NewChangeAffiliationTransaction(empid)
	mt.itsDues = dues
	mt.itsMemberId = memberId
}

func (mt *ChangeMemberTransaction)RecordMembership(e Model.Employee)  {
	DataBase.PayrollDatabase.AddUnionMember(mt.itsMemberId,e)
}

func (mt *ChangeMemberTransaction)GetAffiliation() Model.Affiliation  {
	return ModelImplementation.NewUnionAffiliation(mt.itsMemberId,mt.itsDues)
}